﻿<%@ Page Title="" Language="C#" MasterPageFile="~/back/Site.master" AutoEventWireup="true"
    CodeFile="AddMenu.aspx.cs" Inherits="back_AddMenu" %>

<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <script type="text/javascript" language="javascript">
        $(document).ready(function () {
            if ($('#<%=chkIsParent.ClientID %>').is(':checked')) {
                $('#trMenuCount').fadeIn();
                $('#trMenuCountSub').fadeIn();
            }
            else {
                $('#trMenuCount').fadeOut();
                $('#trMenuCountSub').fadeOut();
            }
            $('#<%=chkIsParent.ClientID %>').click(function () {
                if ($('#<%=chkIsParent.ClientID %>').is(':checked')) {
                    $('#<%=drpMenuOrder.ClientID %>').val(0);
                    $('#trMenuCount').fadeIn();
                    $('#trMenuCountSub').fadeIn();
                }
                else {
                    $('#trMenuCount').fadeOut();
                    $('#trMenuCountSub').fadeOut();
                }
            });
            $('[data-rel="chosen"],[rel="chosen"]').chosen();
            $("input:checkbox, input:radio, input:file").not('[data-no-uniform="true"],#uniform-is-ajax').uniform();

            $('#MainContent_txtMenuLink').bind('keypress', function (event) {
                if (event.keyCode != 8) {
                    var regex = new RegExp("^[a-zA-Z0-9.]*$");
                    var InputValue = String.fromCharCode(!event.keyCode ? event.which : event.keyCode);
                    var key = $(this).val();
                    key = key + InputValue;
                    if (!regex.test(key)) {
                        event.preventDefault();
                        return false;
                    }
                }
            });
        });
        var prm = Sys.WebForms.PageRequestManager.getInstance();

        prm.add_endRequest(function () {
            $('[data-rel="chosen"],[rel="chosen"]').chosen();
        });
        
    </script>
    <div class="page-header">
        <h1>
            Add Menu</h1>
    </div>
    <div id="divMessage" runat="server">
    </div>
    <div class="control-group">
        <label class="control-label">
            Menu Name</label>
        <div class="controls">
            <asp:TextBox ID="txtMenuName" runat="server" CssClass="input-xlarge"></asp:TextBox>
            <asp:RequiredFieldValidator ID="rfvMenuTitle" runat="server" CssClass="alert-error"
                ErrorMessage="Please enter Menu title" ControlToValidate="txtMenuName" Display="Dynamic"></asp:RequiredFieldValidator>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">
        </label>
        <div class="controls">
            <asp:CheckBox ID="chkIsParent" runat="server" Font-Bold="True" Text="IsParent"
                CssClass="checkbox inline" />
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">
            Select Menu
        </label>
        <div class="controls">
            <asp:UpdatePanel ID="pnlMenu" runat="server">
                <ContentTemplate>
                    <asp:DropDownList ID="drpMainMenu" data-rel="chosen" runat="server" AutoPostBack="true"
                        OnSelectedIndexChanged="drpMainMenu_SelectedIndexChanged" DataTextField="MenuName"
                        DataValueField="Id">
                    </asp:DropDownList>
                    <asp:DropDownList ID="drpSubMenu" data-rel="chosen" runat="server" AutoPostBack="false"
                        DataTextField="MenuName" DataValueField="Id">
                    </asp:DropDownList>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">
            Menu Count
        </label>
        <div class="controls">
            <asp:DropDownList ID="drpMenuOrder" data-rel="chosen" runat="server" AutoPostBack="false"
                DataTextField="MenuName" DataValueField="Id">
            </asp:DropDownList>
        </div>
    </div>
    <div class="control-group">
        <label class="control-label">
            Menu Link</label>
        <div class="controls">
            <asp:TextBox ID="txtMenuLink" runat="server" CssClass="input-xlarge"></asp:TextBox>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="Please enter Menu Link(File Name)"
                ControlToValidate="txtMenuLink" Display="Dynamic"></asp:RequiredFieldValidator>
        </div>
    </div>
    <div class="form-actions">
        <asp:Button ID="btnSubmit" runat="server" CssClass="btn btn-primary" Text="Submit"
            OnClick="btnSubmit_Click" />
    </div>
</asp:Content>
